From: Jan Beulich Date: Wed, 28 Jan 2015 15:38:20 +0000 (+0100) Subject: x86: skip further initialization for idle domains X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3822 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=e5f317bda12a99d72e80f1fd639a53e36d377c44;p=xen.git x86: skip further initialization for idle domains While in the end not really found necessary, early versions of the patches to follow pointed out that we needlessly set up paging for idle domains. Arranging for that to be skipped made me notice that we can at once skip vMCE setup for them. Leverage to adjustment to further re-arrange the way FPU setup gets skipped. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 50b361b47d..cfe7945ba5 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -427,12 +427,15 @@ int vcpu_initialise(struct vcpu *v) if ( rc ) return rc; - paging_vcpu_init(v); + if ( !is_idle_domain(d) ) + { + paging_vcpu_init(v); - if ( (rc = vcpu_init_fpu(v)) != 0 ) - return rc; + if ( (rc = vcpu_init_fpu(v)) != 0 ) + return rc; - vmce_init_vcpu(v); + vmce_init_vcpu(v); + } if ( has_hvm_container_domain(d) ) { @@ -559,12 +562,12 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags) HYPERVISOR_COMPAT_VIRT_START(d) = is_pv_domain(d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u; - if ( (rc = paging_domain_init(d, domcr_flags)) != 0 ) - goto fail; - paging_initialised = 1; - if ( !is_idle_domain(d) ) { + if ( (rc = paging_domain_init(d, domcr_flags)) != 0 ) + goto fail; + paging_initialised = 1; + d->arch.cpuids = xmalloc_array(cpuid_input_t, MAX_CPUID_INPUT); rc = -ENOMEM; if ( d->arch.cpuids == NULL ) diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c index a372e0b503..14f2a79e7b 100644 --- a/xen/arch/x86/i387.c +++ b/xen/arch/x86/i387.c @@ -303,12 +303,8 @@ void save_fpu_enable(void) /* Initialize FPU's context save area */ int vcpu_init_fpu(struct vcpu *v) { - int rc = 0; + int rc; - /* Idle domain doesn't have FPU state allocated */ - if ( is_idle_vcpu(v) ) - goto done; - if ( (rc = xstate_alloc_save_area(v)) != 0 ) return rc; @@ -318,13 +314,9 @@ int vcpu_init_fpu(struct vcpu *v) { v->arch.fpu_ctxt = _xzalloc(sizeof(v->arch.xsave_area->fpu_sse), 16); if ( !v->arch.fpu_ctxt ) - { rc = -ENOMEM; - goto done; - } } -done: return rc; }